﻿using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Transactions;
using Newtonsoft.Json;
using T.FAS.Runtime.Base.Entity;
using T.ServiceComponent.DAC.Service;
using System.Reflection;
using System.Data;
using T.ServiceComponent.DataAccessEx.Core;

namespace T.FAS.Runtime.Base.Dao
{
    public class ChartInstanceDao : DaoService<ChartInstance>
    {
        public override string TableName => "FAS_ChartInstance";
        public override string IDColumnName => "ApplyID";
        public ChartInstanceDao() : base()
        {
            DBName = "TFAS";
        }
        public override List<string> ExceptColumnName => new List<string> {  };
        public override Dictionary<string, object> GetDataMapping(ChartInstance data)
        {
            var datas = base.GetDataMapping(data);
            return datas;
        }
        public override ChartInstance ConvertToObject(Dictionary<string, PropertyInfo> columns, DataRow row)
        {
            var myCol = new Dictionary<string, PropertyInfo>(base.Columns);
            var data = base.ConvertToObject(myCol, row);
            return data;
        }
        /// <summary>
        /// 删除实例
        /// </summary>
        public void DeleteInstance(string applyID)
        {
            List<IDbDataParameter> paramList = new List<IDbDataParameter>();
            paramList.Add(DB.MakeInParam("@applyID", TDbDataType.VarChar, applyID));
            var sql = $"delete from {TableName} Where ApplyID=@applyID";
            DB.ExecSqlStatement(sql, paramList.ToArray());
        }
    }
}
